package Modal;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class TxtPrinter implements Printer{
    @Override
    public void writeToTxt(String str) {
        FileWriter fileWriter = null;
        try {
            fileWriter = new FileWriter(new File("receipt.txt"));
            fileWriter.write(str);
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            if (fileWriter != null) {
                fileWriter.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
